//
//  GlobalConfig.h
//  DogeLegs
//
//  Created by 宋华 on 2017/8/15.
//  Copyright © 2017年 宋华. All rights reserved.
//

#ifndef GlobalConfig_h
#define GlobalConfig_h
#import "NSString+MD5.h"


#define IOS8 ([[[UIDevice currentDevice]systemVersion] floatValue] >= 8.0)
#define IOS7 ([[[UIDevice currentDevice]systemVersion] floatValue] >= 7.0)
#define IOS6 ([[[UIDevice currentDevice]systemVersion] floatValue] >= 6.0)
#define iPhone4 ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(640, 960), [[UIScreen mainScreen] currentMode].size) : NO)
#define iPhone5 ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(640, 1136), [[UIScreen mainScreen] currentMode].size) : NO)
#define iPhone6 ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(750, 1334), [[UIScreen mainScreen] currentMode].size) : NO)

//屏幕的宽度，屏幕的高度
#define kScreenHeight [[UIScreen mainScreen] bounds].size.height
#define kScreenWidth  [[UIScreen mainScreen] bounds].size.width
#define kIphone5Width 320.000000
#define kPlusWidth 414.000000
#define kIphone6Width 375.000000

#define kPlusHeight 736.000000
#define kIphone6Height 667.000000
#define kIphone4Height 480.000000
#define kIphone5Height 568.000000

#define kNavAndStatusBarHeight 64
#define kNumkeybordHeight 226 //4寸 216 4.7寸216 5.5 216 其实是取最大的

#define WeakSelf(weakSelf)      __weak __typeof(&*self)    weakSelf  = self;


#ifdef DEBUG
#define Log(fmt, ...) NSLog((fmt), ##__VA_ARGS__);
#else
#define Log(...);
#endif

#define NSStringFormat(format,...)[NSString stringWithFormat:format,##__VA_ARGS__]


#define IS_LOGIN @"is_login"
#define LOGIN_EmailAddress  @"loginEmailAddress"
#define LOGIN_PASSWord @"loginPassword"
#define UserAddress @"UserAddress"

//将数字进行MD5加密
#define MD5Encrypt(src) [src MD5Hash]

#define USERID [[UserManager shareInstance] getUserId]

//根据userId，创建不同目录
#define FileDirectoryName MD5Encrypt(USERID)
//本地沙盒的路径
#define LocalFilePath [FilePathMode localDocumentPath]

#define kUserDefaults [NSUserDefaults standardUserDefaults]


#pragma mark ------- 聊天模块宏定义 ------------

//获取聊天记录的条数
#define kRecordPerPage 15
// 消息显示时间的时间间隔
#define kIntervalOfShowTime 2 * 60.0

#define LOAD_NUMBER kRecordPerPage

//离左宽度
#define LEFT_WITH (kScreenWidth>750?55:52.5)
//离右宽度
#define RIGHT_WITH (kScreenWidth>750?89:73)

#define UserID [[UserManager shareInstance] getUserId]

#define Font(x) [UIFont systemFontOfSize:(x)]

//聊天音频文件 存储路径
#define LocalVoicePath(storeId, fileName) [NSString stringWithFormat:@"%@/%@/%@/%@", LocalFilePath, MD5Encrypt(storeId), @"voice", fileName]
//聊天图片文件 存储路径
#define LocalImagePath(storeId, fileName) [NSString stringWithFormat:@"%@/%@/%@/%@", LocalFilePath, MD5Encrypt(storeId), @"image", fileName]


#pragma mark ------颜色相关的宏-------

#define kGetColor(r, g, b) [UIColor colorWithRed:(r)/255.0 green:(g)/255.0 blue:(b)/255.0 alpha:1] //根据RGB来获取颜色

#define kGetColorWithAlpha(r, g, b, a) [UIColor colorWithRed:(r)/255.0 green:(g)/255.0 blue:(b)/255.0 alpha:a] //根据RGBA来获取颜色

#define HEXCOLOR(rgbValue) [UIColor colorWithRed:((float)((rgbValue & 0xFF0000) >> 16))/255.0 green:((float)((rgbValue & 0xFF00) >> 8))/255.0 blue:((float)(rgbValue & 0xFF))/255.0 alpha:1.0]

#define KNormalOrangeColor (kGetColorWithAlpha(0xff, 0x66, 0x00, 1.0)) // 程序中的普通橙色
#define kProgrameBackgroundColor HEXCOLOR(0xf2f2f2)
#define kProgramColorStyle HEXCOLOR(0xf6ab00)

#define KNormalGrayColor (kGetColorWithAlpha(234, 239, 246, 1.0)) //程序中的普通灰色

#define KLightGrayColor ([UIColor lightGrayColor]) //程序中的普通灰色
#define KLoginGrayColor (kGetColorWithAlpha(0xeb, 0xee, 0xf5, 1.0)) //登录的普通灰色
#define KLoginOrangeColor (kGetColorWithAlpha(0xfc, 0x70, 0x23, 1.0)) //登录的普通灰色

#define KLoginButtonTextColor (kGetColorWithAlpha(0x88, 0x88, 0x88, 1.0)) //登录的普通灰色

#define KNickNameOrangeColor (kGetColorWithAlpha(0xff, 0x66, 0x00, 0.7)) //登录的普通灰色

#define KNickNameGrayColor (kGetColorWithAlpha(0xeb, 0xee, 0xf5, 0.7)) //登录的普通灰色
#define OrangeNormal (kGetColorWithAlpha(0xff, 0x66, 0, 1.0))
#define OrangeHighligted (kGetColorWithAlpha(0xff, 0x66, 0, 0.5))
#define globeSiCunColorGray (kGetColorWithAlpha(0xad, 0xad, 0xad, 1.0))


#define kPriceMaxIntegerNum 12
#define kPriceMaxFloatNum 2

#define kNotePictureMaxNum 9

#define kNotePicsMaxWidth 255


#define kOnlyPicMaxLedgeLength 200

#define kOnlyPicMinLedgeLength 120

#pragma mark - 帖子详情
#define kContentMaxWidth (kScreenWidth - 30)

#endif /* GlobalConfig_h */
